<?php

function smarty_function_get_topic_type ($params, &$smarty) 
{
  $type_id = $params['type_id'];

  if(isset($type_id)){
    //Query type data

    //Check exist user & topic
    $pntables = pnDBGetTables();
    $table  = $pntables['innoforum_type'];
    $column = $pntables['innoforum_type_column'];

    $sql = "SELECT
              $table.$column[name]  
            FROM
              $table 
            WHERE
              $table.$column[id] = ".$type_id;

    $column = array("name");
    $result = DBUtil::executeSQL($sql);
    $objectArray = DBUtil::marshallObjects ($result, $column);
    //$smarty->assign("type_name", $objectArray[0]['name']);
    return $objectArray[0]['name'];
  }
}
